//
//  VEDrewwithTableViewCell.m
//  VEMoneyPorject
//
//  Created by BlueWind on 2018/9/30.
//  Copyright © 2018 陈建. All rights reserved.
//

#import "VEDrewwithTableViewCell.h"

@interface VEDrewwithTableViewCell()

@property (nonatomic, strong)UILabel *coinCount;

@property (nonatomic, strong)UILabel *timeOut;

@end

@implementation VEDrewwithTableViewCell

/** 返回循环利用的cell */
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self= [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self loadDefaultSetting];
    }
    return self;
}

/** 加载默认UI元素和需要的数据 */
- (void)loadDefaultSetting {
    
    UILabel *count = [UILabel new];
    [self.contentView addSubview:count];
    [count mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).offset(GAP15);
        make.top.equalTo(self.contentView).offset(GAP15);
    }];
    
    count.textColor = [UIColor colorWithHexString:kDetailTextBlackColor];
    count.font = kFont(14);
    count.text = @"获得币数:";
    
    self.coinCount = [UILabel new];
    [self.contentView addSubview:self.coinCount];
    [self.coinCount mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(count);
        make.left.equalTo(count.mas_right).offset(GAP8);
    }];
    self.coinCount.textColor = [UIColor colorWithHexString:kDetailTextGrayBlackColor];
    self.coinCount.font = kFont(14);
    self.coinCount.text = @"500";
    
    UILabel *time = [UILabel new];
    [self.contentView addSubview:time];
    [time mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).offset(GAP15);
        make.top.equalTo(count.mas_bottom).offset(GAP8);
    }];
    
    time.textColor = [UIColor colorWithHexString:kDetailTextBlackColor];
    time.font = kFont(14);
    time.text = @"到期时间:";
    
    self.timeOut = [UILabel new];
    [self.contentView addSubview:self.timeOut];
    [self.timeOut mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(time);
        make.left.equalTo(time.mas_right).offset(GAP8);
    }];
    self.timeOut.textColor = [UIColor colorWithHexString:kDetailTextGrayBlackColor];
    self.timeOut.font = kFont(14);
    self.timeOut.text = @"2018-02-23 15:26";
    
    UIView *view = [UIView new];
    [self.contentView addSubview:view];
    [view mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.contentView);
        make.left.equalTo(self.contentView);
        make.right.equalTo(self.contentView);
        make.height.mas_equalTo(0.5);
    }];
    view.backgroundColor = [UIColor colorWithHexString:kLineViewBgColor];
}

- (void)setModel:(VEWaitDrewwithModel *)model {
    _model = model;
    self.coinCount.text = [NSString stringWithFormat:@"%ld",model.ZONGQIANSHU];
    self.timeOut.text = model.DAOQITIME;
}

@end
